-#
-# Copyright (C) 2013 Google Inc., authors, and contributors <see AUTHORS file>
-# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
-# Created By:
-# Maintained By:
-#
-extends 'layouts/_widget_box.haml'

-block widget_help
  governance

-block widget_id
  governance_widget

-block widget_class
  governance

-block widget_title
  Governance / Compliance

-block widget_buttons
  .filter
    .row-fluid
      .span8
        %input.ui-corner-all.widgetsearch.clear-value{ 'type': 'text', 'placeholder': 'Search' }
      .span4
        %a.btn.btn-add.pull-right{ 'href': 'javascript://', 'data-toggle': 'modal-ajax-form', 'data-modal-reset': 'reset', 'data-form-target': 'refresh', 'data-modal-class': 'modal-wide', 'data-object-singular': 'Control', 'data-object-plural': 'controls' } 
          %i.grcicon-add
          %span.object-type Control

-set quick_result = quick_result if quick_result is defined else None
-set prefix = "qf" if quick_result else "dash"
-set tabbable_id = '' if quick_result is defined else 'quick_find'

-from 'shared/_quick_find.haml' import tab

-block main
  .tabbable.tabs-left{ 'id': '{{ tabbable_id }}' }
    -# FIXME: Fix all `data-tab-href` and `data-new-href` attribute paths
    %ul.nav.nav-tabs
      =tab("Regulation", "Regulations", "/search?s=&qr={0}".format(quick_result_business_objects), "", "governance")
      =tab("Policy", "Policies", "/search?s=&qr={0}".format(quick_result_business_objects), "", "governance")
      =tab("Contract", "Contracts", "/search?s=&qr={0}".format(quick_result_business_objects), "", "governance")
      =tab("Control", "Controls", "/search?s=&qr={0}".format(quick_result_business_objects), "active", "governance")

    .tab-content
      .tab-pane{ id : "#{prefix}_regulations" }
      .tab-pane{ id : "#{prefix}_policies" }
      .tab-pane{ id : "#{prefix}_contracts" }
      .tab-pane{ id : "#{prefix}_controls" }
